package com.wyj.event;

import com.alibaba.fastjson.JSONObject;
import com.wyj.pojo.Comment;
import io.lettuce.core.dynamic.annotation.CommandNaming;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;
import com.wyj.pojo.event;

/**
 * @author 王永杰
 * @Description 描述该类的做什么用
 * @since 2022/8/18
 */
@Component
public class EventProducer {

    @Autowired
    KafkaTemplate kafkaTemplate;


    //处理事件  将事件发布到主题当中
    public void fireEvent(event event) {
        kafkaTemplate.send(event.getTopic(), JSONObject.toJSONString(event));
    }



}
